package com.xjgzinfo.usdp.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 分类
 *
 * @author jxw
 */
@Entity
@Table(name = "blade_visual_category")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class BladeVisualCategory implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "snowFlakeIdGenerator", strategy = "com.xjgzinfo.usdp.domain.util.SnowFlakeIdGenerator")
    @GeneratedValue(generator = "snowFlakeIdGenerator", strategy = GenerationType.SEQUENCE)
    @JsonFormat(shape = JsonFormat.Shape.NUMBER)
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 分类键值
     */
    @Size(max = 50)
    @Column(name = "category_key", length = 50)
    private String categoryKey;

    /**
     * 分类名称
     */
    @Size(max = 64)
    @Column(name = "category_value", length = 64)
    private String categoryValue;

    /**
     * 是否已删除
     */
    @NotNull
    @Max(value = 10)
    @Column(name = "is_deleted", nullable = false)
    private Integer isDeleted = 0;

    // jhipster-needle-entity-add-field - JHipster will add fields here
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCategoryKey() {
        return categoryKey;
    }

    public void setCategoryKey(String categoryKey) {
        this.categoryKey = categoryKey;
    }

    public BladeVisualCategory categoryKey(String categoryKey) {
        this.categoryKey = categoryKey;
        return this;
    }

    public String getCategoryValue() {
        return categoryValue;
    }

    public void setCategoryValue(String categoryValue) {
        this.categoryValue = categoryValue;
    }

    public BladeVisualCategory categoryValue(String categoryValue) {
        this.categoryValue = categoryValue;
        return this;
    }

    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public BladeVisualCategory isDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
        return this;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof BladeVisualCategory)) {
            return false;
        }
        return id != null && id.equals(((BladeVisualCategory) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "BladeVisualCategory{" +
                "id=" + getId() +
                ", categoryKey='" + getCategoryKey() + "'" +
                ", categoryValue='" + getCategoryValue() + "'" +
                ", isDeleted=" + getIsDeleted() +
                "}";
    }
}
